package com.fsxgt.datagrid.ds.tool;


public class SqlServerSqlTool extends BaseSqlTool  {
    private volatile static SqlServerSqlTool single;

    public static SqlServerSqlTool getInstance() {
        if (single == null) {
            synchronized (SqlServerSqlTool.class) {
                if (single == null) {
                    single = new SqlServerSqlTool();
                }
            }
        }
        return single;
    }

    @Override
    public String getSQLQueryTables() {
        return "SELECT Name FROM SysObjects Where XType='U' ORDER BY Name";
    }

    @Override
    public String getSQLQueryTables(String... tableSchema) {
        return "select schema_name(schema_id)+'.'+object_name(object_id) from sys.objects \n" +
                "where type ='U' \n" +
                "and schema_name(schema_id) ='" + tableSchema[0] + "'";

    }

    @Override
    public String getSQLQueryTableSchema(String... args) {
        return "select distinct schema_name(schema_id) from sys.objects where type ='U';";
    }

}
